home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 4 / Apprentice-Release4.iso / Utilities / Programming / EnterAct 3.5 / Drag_on Modules / hAWK programs / $LineCount < prev    next >
Encoding:
Text File  |  1992-05-24  |  358 b   |  23 lines  |  [TEXT/KEEN]

  1. #$LineCount: get lines in each input file, and total up at the end
  2. #Use MFS input option, and show stdout.
  3.  
  4. FNR == 1{
  5.     if (count+0 > 0)
  6.         {
  7.         print names[n] ":", count
  8.         total += count
  9.         count = 0
  10.         }
  11.     n = split(FILENAME, names, ":")
  12.     }
  13.  
  14.     {++count}
  15.  
  16. END {
  17.     if (count+0 > 0)
  18.         {
  19.         print names[n] ":", count
  20.         total += count
  21.         }
  22.     print "Total lines:", total
  23.     }